
namespace ShoppingCart.Business.Logic
{
	using System;
	using System.Collections.Generic;
	using Business.Entity;
	using DataAccess;

	/// <summary>
	/// Represents the Manager of Envio.
	/// </summary>
	[Serializable]
	public class EnvioManager : Singleton<EnvioManager>
	{
		#region Methods

		/// <summary>
		/// Selects a single record from the Envio table.
		/// </summary>
		public Envio Obtener(int idEnvio)
		{
			try
			{
				return EnvioData.Instancia.Obtener(idEnvio);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Selects all records from the Envio table by a foreign key.
		/// </summary>
		public IList<Envio> ListarPorIdPedido(int idPedido)
		{
			try
			{
				return EnvioData.Instancia.ListarPorIdPedido(idPedido);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Saves a record to the Envio table.
		/// </summary>
		public int Agregar(Envio envio)
		{
			try
			{
				return EnvioData.Instancia.Agregar(envio);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Updates a record in the Envio table.
		/// </summary>
		public bool Modificar(Envio envio)
		{
			try
			{
				return EnvioData.Instancia.Modificar(envio);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Deletes a record from the Envio table by its primary key.
		/// </summary>
		public bool Eliminar(int idPedido)
		{
			try
			{
				return EnvioData.Instancia.Eliminar(idPedido);
			}
			catch (Exception) { throw; }
		}

		#endregion
	}
}
